<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script>
	var a = '${lists.size()}';
</script>
<html>
	<head>
		<title>购物车</title>
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/reset.css" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/main.css" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/table.css" />
		<script src="<%=request.getContextPath() %>/js/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/shopCart.js" ></script>
		<% 
			String username = (String)request.getSession().getAttribute("user");
		%>
	</head>
	<body>
		<div class="head">
			<div class="top-first">
				<div class="comWidth">
					<div class="leftArea">
						<a href="#" class="collection">商城首页</a>
					</div>
					<div class="rightArea welcome">
						<span>欢迎您来到数码商城！</span>
						<%if(username==null){ %>
						<a href="<%=request.getContextPath() %>/login/index">[登录]</a>
						<%}
						else{%>
						<label><%=username %></label>	
						<%}%>
						<a href="<%=request.getContextPath() %>/login/register">[注册]</a>
					</div>
				</div>
			</div>
			<div class="top-second">
				<div class="comWidth">
					<div class="logo fl">
						<a href="#" ><img src="<%=request.getContextPath() %>/img/logo.png"/></a>
					</div>
					<div class="search fl">
						<input type="text" class="search-text fl" placeholder="请输入商品名称">
						<input type="button" class="search-btn fl" value="搜	索"/>
					</div>
				</div>
			</div>
			<div class="top-third">
				<div class="comWidth">
					<div id="category" class="dorpdown">
						<div class="dt">全部分类</div>
					</div>
					<div class="navitems">
						<ul>
							<li>
								<a target="_blank" href="#" class="nav-color">首页</a>
							</li>
							<li>
								<a target="_blank" href="#">数码城</a>
							</li>
							<li>
								<a target="_blank" href="#">团购</a>
							</li>
							<li>
								<a target="_blank" href="#">发现</a>
							</li>
							<li>
								<a target="_blank" href="#">二手特卖</a>
							</li>
							<li>
								<a target="_blank" href="#">名品会</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		
		<br /><br />
		
		<h2 class="comWidth" style="height: 40px;color: #0099FF;font-size:16px;font-weight:700;line-height: 26px;">购物车</h2>
		<div style="display: block;">
					<form action="" method="post">
						<input value="${lists.size() }" type="hidden" id="size" />
						<table class="table table-hover text-center">
							<tr>
								<th width="80"><span onclick="chooseAll()" class="checkbox"/><input type="checkbox" class="checkbox"> 全选</span></th>
								<th width="50%">商品</th>
								<th width="10%">单价</th>
								<th width="10%">数量</th>
								<th width="10%">小计</th>
								<th>操作</th>
							</tr>
							<% int i = 1; %>
							<c:forEach items="${lists }" var="list">
								<tr style="height: 114px; display: compact ;" id="tr<%=i %>">
									<td><input type="checkbox" name="id[]" value="2" id="checkbox<%=i %>" onclick="choose(<%=i %>)"/><%=i %>
									</td>
									<td>
										<img class="imgShoppingCart" src="<%=request.getContextPath() %>/${list.Pimg}" />
										${list.pName }&nbsp;【${list.Ram }+${list.Rom }GB】&nbsp;${list.pDesc }
									</td>
									<td>￥<span id="unitPrice<%=i %>">${list.iPrice }</span></td>
									<td class="op-number">
										<a href="javascript:void(0);" class="decrement" id="decrement<%=i %>" onclick="prev(<%=i %>)">-</a>
										<input type="text" name="num" value="${list.number }" class="num-center" id="num<%=i %>" oninput="inputChange(<%=i %>);">
										<a href="javascript:void(0);" class="increment" id="increment<%=i %>" onclick="next(<%=i %>)">+</a>
									</td>
									<td>￥<span id="totalPrice<%=i %>"></span></td>
									<td>
										<a class="button-group button button1 shan<%=i %>" href="javascript:void(0)" name="${list.id }" onclick="del(${list.id})">
											<span class="icon-trash-o"></span> 删除
										</a>
									</td>
								</tr>
								<% i++; %>
							</c:forEach>
							<tr style="height: 60px;">
								<td>
									<span onclick="chooseAll()" class="checkbox"><input type="checkbox" class="checkbox"/> 全选</span>
								</td>
								<td></td>
								<td></td>
								<td>共 <span id="count">0</span> 件</td>
								<td>总计：<span class="td-red">¥<span id="money">0</span></span></td>
								<td>
									<a class="send-button" href="javascript:void(0)" onclick="settlement()">
										去结算
									</a>
								</td>
							</tr>
						</table>
					</form>
				</div>
			
		<br /><br />
			
		<div class="comWidth" >
			<img src="<%=request.getContextPath() %>/img/foot.png" style="width: 1211px;"/>
		</div>
			
		<div class="footbar">
		      <div id="web_wj">
					<p>制作团队：ELEMENT TEAM</p>
					<p>
					Copyright &#169;2016-2017 <a title="数码商城" href="#">www.DM.com</a>
						All Rights Reserved <a title="船舶网" href="#">数码商城</a> 版权所有
					</p>
			</div>
		</div>
	</body>
</html>
